package com.lxw.mq;

import com.alibaba.fastjson.JSON;

import com.lxw.dao.CmsPageRepository;
import com.lxw.service.CmsPagePostService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public class CusumerCmsPagePost {



    @Autowired
    private CmsPagePostService cmsPagePostService;

    @RabbitListener(queues = {"${yh.mq.queue}"})
    public void postCmsPage(String msg){
        Map map = JSON.parseObject(msg, Map.class);
        String pageId = (String)map.get("pageId");
        cmsPagePostService.savePage2Location(pageId);
    }
}
